#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

typedef struct TreeNode
{
	char data;
	struct TreeNode* lchild;
	struct TreeNode* rchild;
}TreeNode, * BiTree;

int CreateTree(BiTree& t)
{
	char ch;
	scanf("%c", &ch);
	if (ch == '#')
	{
		t = NULL;
		return 0;
	}
	else
	{
		t = (BiTree)malloc(sizeof(TreeNode));
		if (!t)
		{
			return -1;
		}
		t->data = ch;
		CreateTree(t->lchild);
		CreateTree(t->rchild);
	}
	return 1;
}

int provisit(BiTree t)
{
	if (t == NULL)
		return -1;
	else
	{
		provisit(t->lchild);
		provisit(t->rchild);
		printf("%c", t->data);
	}
}
int main()
{
	BiTree t;
	CreateTree(t);
	provisit(t);
}